home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 August: Tool Chest / Dev.CD Aug 94.toast / Tool Chest / Networking & Communications / MacTCP / MacTCP Developer Tools / HyperCard MacTCP Toolkit 1.0 / Source Code ƒ / TCPRelease.p < prev    next >
Encoding:
Text File  |  1993-06-15  |  1.4 KB  |  64 lines  |  [TEXT/MPS ]

  1. (*
  2.     TCPRelease(connectionID) -- Release the TCP stream, including the buffer.
  3.  
  4.     To compile and link this file using Macintosh Programmer's Workshop,
  5.  
  6.         pascal -w TCPRelease.p
  7.         link -m ENTRYPOINT -o HyperCommands -rt XCMD=7862 -sn Main=TCPRelease ∂
  8.             TCPRelease.p.o "{Libraries}HyperXLib.o" "{MPW}"Libraries:interface.o
  9.  
  10.     © Copyright 1988 by Apple Computer, Inc.
  11.  
  12.     Initial coding 12/88 by Harry R. Chesley.
  13. *)
  14.  
  15. {$R-}
  16.  
  17. {$S TCPRelease }     { Segment name must be the same as the command name. }
  18.  
  19. unit DummyUnit;
  20.  
  21. interface
  22.  
  23. uses MemTypes, QuickDraw, OSIntf, HyperXCmd;
  24.  
  25. procedure EntryPoint(paramPtr: XCmdPtr);
  26.     
  27. implementation
  28.  
  29. procedure TCPRelease(paramPtr: XCmdPtr); forward;
  30.  
  31. procedure EntryPoint(paramPtr: XCmdPtr);
  32.  
  33.     begin
  34.         TCPRelease(paramPtr);
  35.     end;
  36.  
  37. procedure TCPRelease(paramPtr: XCmdPtr);
  38.  
  39.     var releaseFailed: boolean;
  40.  
  41.     procedure Fail(errMsg: Str255); { set theResult and quit }
  42.         begin
  43.             paramPtr^.returnValue := PasToZero(paramPtr,errMsg);
  44.             exit(TCPRelease);
  45.         end;
  46.  
  47.     {$I TCPUtil.inc}
  48.  
  49.     begin
  50.         if paramPtr^.paramCount <> 1 then Fail('§§§ parameter count is not 1 §§§');
  51.  
  52.         SetUpConnectionID;
  53.  
  54.         { Issue a release command. }
  55.         ZeroIOParms;
  56.         SyncControlBlock.csCode := TCPcsRelease;
  57.         releaseFailed := PBControl(@SyncControlBlock,false) <> noErr;
  58.         Connection^.magic := '????';
  59.         if releaseFailed then Fail('§§§ release failed §§§')
  60.         else DisposPtr(Ptr(Connection));
  61.     end;
  62.  
  63. end.
  64.